package 作业;

import java.util.Arrays;
import java.util.Scanner;

public class 接收数据并打印每个年龄的值 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int[] age = new int[5];
        //age[0] = sc.nextInt();
        //age[1] = sc.nextInt();
        //age[2] = sc.nextInt();
        //age[3] = sc.nextInt();
        //age[4] = sc.nextInt();

        for (int i = 0; i < age.length; i++) {

            System.out.println("请输入第" + (i + 1) + "名同学的年龄：");
            age[i] = sc.nextInt();
            System.out.println("第" + (i + 1) + "名同学的年龄是" + age[i] + "岁");

        }
        //这可以实现快速的遍历数值
        System.out.println(Arrays.toString(age));
    }
}
